/**
 *	\file AKStateMaintainer.h
 *  
 *  \section desc_sec Description
 *  Description
 *  
 *  \if copyright
 *  	Copyright 2008 Ben Chen. All rights reserved.
 *  \endif
 *  
 *  \section hist_sec Change History:
 *  	-	1/13/08		BC		Created this file
 *  
 *  <hr>
 *  \addtogroup AnimalKingdom
 *  @{
 */

#import "AKPlugIn.h"

@protocol AKStateMaintainer

/**
 *  Go back to initial state.
 */
- (void)backToInitialState;

/**
 *  Perform a move.
 *  \param[in] newMove A new move.
 *  \return YES if the move has been made, otherwise NO meaning the move is not permitted.
 */
- (BOOL)performMove:(AKMove)newMove;

/**
 *  Get cells that the given existing piece can move to.
 *  \param[in] cell The info about the given piece.
 *  \return Array of AKCellIndex wrapped in NSNumber.
 */
- (NSArray*)reachableCellsForPiece:(AKPiece)piece; 

/**
 *  Get the type of pieces of the current side that can be created and placed at the given cell.
 *  e.g. In the game of Tic-Tac-Toe, every new move is made by creating a new piece at an empty cell.
 *  \param[in] cell The index of the given cell.
 *  \return Array of AKPieceIndex wrapped in NSNumber;
 */
- (NSArray*)newPiecesAtCell:(AKCellIndex)cell;

/**
 *	Return the piece that is standing in the specified cell.
 */
- (AKPiece)moveablePieceAtCell:(AKCellIndex)cell;

#pragma mark properties

@property (readonly, copy) NSArray* eliminatedPieces;	// AKPieces
@property (readonly, copy) NSArray* createdPieces;		// AKPieces
@property (readonly, copy) NSArray* movedPieces;		// AKMoves

/**
 *	The side of the next player.
 *  NSNotFound if no player (e.g. someone wins already), otherwise the index of the next player.
 */
@property (readonly) AKSideIndex nextPlayerSide;

/**
 *	The winners of the game.
 *	NSArray of AKSideIndex.
 */
@property (readonly, copy) NSArray* winners;

/**
 *  The moveable pieces of the current side.
 *  Array of AKCell wrapped in NSData.
 */
@property (readonly, copy) NSArray* moveablePieces;

@end

/** @} */

